<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="李愧愧">
    <title></title>
    <style>

    </style>
</head>

<body>

    <script>
        // 1，统计一个字符串中出现次数最多的字母是什么。
        // asaddadsadtdadsadcdb
        var str = prompt('请输入字符串：');
        var ch = '';
        var max = 0;
        for (var i = 0; i < str.length; i++) {
            var arr = str.split(str[i]);
            if (max < arr.length-1) {
                max = arr.length-1;
                ch = str[i];
            }
        }
        document.write('最多的字母是' + ch + ',出现' + max + '次');
    </script>
</body>
<ml>